package com.example.stepviewdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;

import com.google.gson.Gson;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MainActivity extends AppCompatActivity {
    private ListView listView;
    private TimeLineAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        listView = findViewById(R.id.lv_list);
        listView.setDividerHeight(0);
        List<Map<String, Object>> maps = initData();
        String s = new Gson().toJson(maps);
        Log.e("======", "onCreate: " + s);
        adapter = new TimeLineAdapter(this, initData());
        listView.setAdapter(adapter);
    }

    private List<Map<String, Object>> initData() {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("title", "提交已完成......");
        map.put("time", "2015-10-22  14:00:00");
        list.add(map);

        map = new HashMap<String, Object>();
        map.put("title", "正在审核中......");
        map.put("time", "2015-10-22  15:00:00");
        list.add(map);

        map = new HashMap<String, Object>();
        map.put("title", "客服将会给您打电话......");
        map.put("time", "2015-10-22  16:00:00");
        list.add(map);

        map = new HashMap<String, Object>();
        map.put("title", "订单已完成");
        map.put("time", "2015-10-22  17:00:00");
        list.add(map);

        return list;

    }

}
